import { NODE } from './constants';
import { COLOR } from '../../../utils/color';
import { randomKey } from '../../../utils/utils';
import { EDGE_TYPE } from 'src/utils/constant';
export function getComponent(componentName, e) {
  switch (componentName) {
    case NODE._START:
      return {
        shape: componentName,
        type: componentName,
        name: '开始节点',
        edge_type: EDGE_TYPE._CONDITION,
        edge_configs: [],
      };
    case NODE._ACTION:
      return {
        shape: componentName,
        type: componentName,
        edge_type: EDGE_TYPE._CONDITION,
        edge_configs: [],
      };
    case NODE._STRATEGY:
      return {
        shape: componentName,
        type: componentName,
        linkPoints: {
          top: true,
          bottom: true,
          size: 5,
          fill: COLOR._WHITE,
          lineWidth: 1,
          stroke: 'blue',
        },
        edge_type: EDGE_TYPE._CONDITION,
        edge_configs: [],
      };

    case NODE._CHALLENGE:
      return {
        shape: componentName,
        type: componentName,
        name: '',
        label: '',
        edge_type: EDGE_TYPE._CONDITION,
        edge_configs: [],
        linkPoints: {
          top: true,
          bottom: true,
          size: 5,
          fill: COLOR._WHITE,
          lineWidth: 1,
          stroke: 'blue',
        },
        nodes: [
          {
            shape: 'strategy',
            type: 'strategy',
            label: '冠军',
            name: '冠军',
            id: randomKey(),
            percent: 99,
          },
          {
            shape: 'strategy',
            type: 'strategy',
            label: '挑战者1',
            name: '挑战者1',
            id: randomKey(),
            percent: 1,
          },
        ],
      };
    default:
      return {};
  }
}
